import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from PIL import Image

#读取图片，并转为数组
# path = "E:/far-space/cxb-python/res/pyicon_32.png"
path = "E:/far-space/cxb-python/res/logo2.ico"

imgRGB = Image.open(path).convert("RGB")
print(imgRGB.tobytes())
with open('图片文件流out.txt', 'w') as f:
  print("return bytearray("+str(imgRGB.tobytes())+")",file=f)